package MapHelper

import (
	"sync"
)

func Exist(key string, mapInfo map[interface{}]interface{}) bool {
	_, ok := mapInfo[key]
	if ok {
		return true
	} else {
		return false
	}
}

func SyncMapToMap(p sync.Map)map[string]interface{}  {
	res:=make(map[string]interface{})
	p.Range(func(key, value interface{}) bool {
		res[key.(string)]=value
		return true
	})
	return res
}

func MapToSyncMap(inputMap map[interface{}]interface{}) sync.Map  {
	p:=sync.Map{}
	for key,value:=range inputMap{
		p.Store(key,value)
	}
	return p
}
